<%-- 
    Document   : new_visit_super
    Created on : Sep 30, 2013, 2:50:01 PM
    Author     : Mansur
--%>

<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>.: Ship Visit :.</title>    
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.blockUI.js"></script>   
        <script type="text/javascript">
            $(function() {
                $("#datepicker2").datepicker({
                    showOn: "button",
                    buttonImage: "${pageContext.request.contextPath}/images/icon/calendar.gif",
                    buttonImageOnly: true,
                    changeMonth: true,
                    dateFormat: 'dd/mm/yy',
                    changeYear: false,
                    maxDate: new Date(),
                    minDate: minDate()
                });
            });
            
            function validateEmpty(){
                var validate = true;
                if($('#vesselId').val() === '' || 
                        $('#datepicker2').val() === '' || 
                        $('#location').val() === '' || 
                        $('#summary').val() === '' ||
                        $('#purpose').val() === '' ||
                        $('#general').val() === '' ||
                        $('#accomodation').val() === '' ||
                        $('#deck').val() === '' ||
                        $('#engine').val() === '' ||
                        $('#crewMorale').val() === '' ||
                        $('#foodMeal').val() === '' ||
                        $('#other').val() === '' ||
                        $('#conclusion').val() === '' ||
                        $('#recommend').val() === ''){
                    alert('All form fields are required! except attachment.');
                    validate  = false;
                }
                return validate;
            }
            
            function popupWin(id) {
                var url = '${pageContext.request.contextPath}/shipVisitFlow?editDocument&idStaff=' + id;
                var left = (screen.width/2)-(1000/2);
                var top = (screen.height/2)-(1000/2);                
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';                
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }                
                return false;
            }
            
            function unblockUI() {
                $.unblockUI();
            }
            
            function blockUI () {
                $.blockUI();
            }
            
            function minDate(){
                var year = ${actionBean.currentYear};
                var date = new Date(year,0,1);
                return date;
            }
        </script>
        <style>
            .validateTips { border: 1px solid transparent; padding: 0.3em; color: red; font-weight: bold}
        </style>
    </head>
    <body>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.ShipVisitFlowAction" name="form1">
            <s:hidden name="counterId" />
            <s:hidden name="currentYear" />
            <div>
                <fieldset>
                    <div id="page-title">
                        <span class="title">Ship Visit</span>
                    </div>
                    <div style="align: center">
                        <span class="sub-title">Ship visit target as per year ${actionBean.currentYear}</span>
                        <display:table class="tablecloth" name="${actionBean.listCounter}" requestURI="/shipVisitFlow" id="line" style="width:50%">
                            <display:column title="Target Visit" property="target"/>
                            <display:column title="No. of visit" property="visited"/>
                            <display:column title="Total Balance"><c:out value="${line.target - line.visited}" /></display:column>                 
                        </display:table>
                    </div>
                    <div id="page-title">
                        <span class="title">New Ship Visit Form</span>
                    </div>
                    <s:messages/>
                    <s:errors/>
                    <p class="validateTips"><em>All form fields are required except Attachment.</em></p>
                    <table border="0" align="center" width="70%">
                        <tr>
                            <td width="13%" style="vertical-align: top; text-align: right;"><b>Vessel Name</b></td>
                            <td width="1%" style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td width="20%" style="vertical-align: top; text-align: left;">
                                <s:select name="shipVisitFlow.vessel.vesselId" id="vesselId" style="width:200px">
                                    <s:option value="">Please Choose</s:option>
                                    <s:options-collection collection="${list.vesselList}" label="vesselName" value="vesselId"/>
                                </s:select>
                            </td>
                            <td width="16%" style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td width="13%" style="vertical-align: top; text-align: right;"><b>Date Visit</b></td>
                            <td width="1%" style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td width="36%" style="vertical-align: top; text-align: left;">
                                <s:text name="shipVisitFlow.dateVisit" id="datepicker2" formatType="date" formatPattern="dd/MM/yyyy" readonly="true"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Location</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:text name="shipVisitFlow.location" id="location" size="50" class="uppercase" />
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>Summary</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.summary" id="summary" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Purpose of Visit</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.purpose" id="purpose" rows="5" cols="50"/>
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>General Condition</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.generalCondition" id="general" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Accommodation</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.accomodation" id="accomodation" rows="5" cols="50"/>
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>Deck</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.deck" id="deck" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Engine</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.engine" id="engine" rows="5" cols="50"/>
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>Crew Morale</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.crewMorale" id="crewMorale" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Food and Meals</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.foodMeal" id="foodMeal" rows="5" cols="50"/>
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>Others</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.other" id="other" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;"><b>Conclusion</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.conclusion" id="conclusion" rows="5" cols="50"/>
                            </td>
                            <td style="vertical-align: top; text-align: left;">&nbsp;</td>
                            <td style="vertical-align: top; text-align: right;"><b>Recommendations</b></td>
                            <td style="vertical-align: top; text-align: left;"><b>:</b></td>
                            <td style="vertical-align: top; text-align: left;">
                                <s:textarea name="shipVisitFlow.recommend" id="recommend" rows="5" cols="50"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: center;" colspan="7"><b>Attachment/s :</b><s:button name="" value="Upload..." class="btn" onclick="return popupWin('${actionBean.staffId}');"/></td>
                        </tr>
                        <tr>
                            <td style="vertical-align: top; text-align: right;" colspan="7">
                                <s:submit name="submit" value="Submit" class="btn" onclick="return validateEmpty();"/>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
        </s:form>
    </body>
</html>
